home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
fish
/
676-700
/
680
/
atap
/
sourcecode
/
findbasename.c
< prev
next >
Wrap
Text File
|
1995-03-18
|
941b
|
35 lines
char *FindBaseName(char *typefaceName)
/* This pulls out a base family name from a typeface name.
This works on Adobe's principle of typeface naming with
dash marks; "AvantGarde-Demi" and "AvantGarde-Oblique"
for example, belong to the family "AvantGarde". Also,
"Helvetica" and "Helvetica-Black" belong to "Helvetica".
Since there can be multiple hyphens in a typeface name,
like "Helvetica-Condensed-Oblique", the last hyphen is
considered and this function would return "Helvetica-Condensed".
Get the string using strcpy(). */
{
static char baseName[68];
static int index,strLength,hyphenLoc;
strLength=strlen(typefaceName);
hyphenLoc=0;
for (index=0;index<=strLength;index++)
{
if (typefaceName[index]=='-')
hyphenLoc=index;
}
if (hyphenLoc==0)
hyphenLoc=strLength;
for (index=0;index<hyphenLoc;index++)
baseName[index]=typefaceName[index];
baseName[hyphenLoc]=0;
return(baseName);
};